package com.wangyb.wework.utils;

import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.spring.SpringUtils;

import java.util.concurrent.TimeUnit;

/**
 * @Author: wangyb
 * @Date: 2021/8/4 6:13 下午
 */
public class MediaCacheUtils {

	//企业微信 临时素材三天有效期
	private final static Integer EXPIRED_DAYS = 3;
	public static void cacheMediaId(String url,String mediaId){
		RedisCache cache = SpringUtils.getBean(RedisCache.class);
		cache.setCacheObject(url,mediaId,EXPIRED_DAYS, TimeUnit.DAYS);
	}
	public static String getMediaId(String url){
		RedisCache cache = SpringUtils.getBean(RedisCache.class);
		return cache.getCacheObject(url);
	}

}
